    public function test($value = '') {
 
+       $ch = curl_init("http://top.baidu.com");
 
+
 
+       curl_setopt($ch, CURLOPT_HEADER, 0);
 
+       curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 
+
 
+       $data = curl_exec($ch);
 
+       $str  = iconv("GB2312", "UTF-8", $data);
 
+
 
+       $pattern = '@<div id="box-today" class="box-today">.*?<a target="_blank" href=".*?">(?<title>.*?)</a>.*?事件.*?<a target="_blank" href=".*?">(.*?)</a>@s';
 
+       preg_match($pattern, $str, $matches);
 
+       echo $matches['title'];
 
+
 
+       curl_close($ch);
 
+   }
 
+   /**
 
+    * 抓取学校网站通知列表数据
 
+    * @return [type] [description]
 
+    */
 
+   public function get_notice_list() {
 
+       // 初始化curl类
 
+       $ch  = curl_init();
 
+       $url = 'http://www.xbmu.edu.cn/frontChannel.action?siteId=1&articleClassId=104';
 
+       // 设定curl搜索地址
 
+       curl_setopt($ch, CURLOPT_URL, $url);
 
+       // 设定curl不返回头信息
 
+       curl_setopt($ch, CURLOPT_HEADER, 0);
 
+       // 设定curl不在网页中直接显示抓取内容
 
+       curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 
+       $content = curl_exec($ch);
 
+       curl_close($ch);
 
+       // 设置抓取正则表达式
 
+       $pattern = '/<li><span>(?<post_time>.*?)<\/span>.*?articleId=(?<post_id>\d*).*?\>(?<post_title>.*?)<\/a>.*?<\/li>/s';
 
+       // // 执行正则表达式
 
+       preg_match_all($pattern, $content, $matched);
 
+       // 取前十条数据
 
+       for ($i = 0; $i < 10; $i++) {
 
+           $data[$i] = array(
 
+               'post_href'  => $matched['post_id'][$i],
 
+               'post_title' => $matched['post_title'][$i],
 
+           );
 
+       }
 
+       var_dump($data);
 
+   }
 
+
 
+   public function info($value = '') {
 
+       phpinfo();
 
+   }
 
+
 
+   public function curl($url = '') {
 
+
 
+       // 初始化curl函数
 
+       $ch = curl_init($url);
 
+
 
+       // 设置必要的配置信息
 
+       curl_setopt($ch, CURLOPT_HEADER, 0);
 
+       curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 
+
 
+       // 执行curl
 
+       $data = curl_exec($ch);
 
+
 
+       // 关闭curl,释放资源
 
+       curl_close($ch);
 
+
 
+       return $data;
 
+   }
 
+
 
+   public function getStdNotice() {
 
+       $data = $this->curl('http://cms.xbmu.edu.cn/frontChannelPage.action?siteId=69&articleClassId=1904');
 
+
 
+       $pattern = '@<a href="(?<url>.*?)" target="_blank">(?<title>.*?)</a>.*?发布日期:(?<date>.*?)</td>@s';
 
+       preg_match_all($pattern, $data, $matches);
 
+       // echo '<pre>';
 
+       // var_dump($matches['url'], $matches['title'], $matches['date']);
 
+       // echo '</pre>';
 
+       echo '<table>';
 
+       for ($i = 0; $i < 5; $i++) {
 
+           echo '<tr><td><a href="' . $matches['url'][$i + 1] . '">' . $matches['title'][$i] . '</a></td><td>' . date('Y-m-d', strtotime($matches['date'][$i])) . '</td></tr>';
 
+       }
 
+       echo '</table>';
 
+   }
 
+
     
 } // 大类结束